/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2023-05-11
 * Time: 16:31
 */

//这是影院的外观模式 的 外观类
public class HomeTheaterFacade {
    //定义各个子系统的对象

    //灯光
    private Lighting lighting;
    //爆米花
    private Popcorn popcorn;
    //立体声
    private Stereo stereo;
    //投影仪
    private Projector projector;
    //屏幕
    private Screen screen;
    //DVD
    private DVDPlayer dvdPlayer;

    //在构造器当中初始化 不用传递参数的方式 用 饿汉式
    public HomeTheaterFacade() {
        this.lighting = Lighting.getInstance();
        this.popcorn = Popcorn.getInstance();
        this.stereo = Stereo.getInstance();
        this.projector = Projector.getInstance();
        this.screen = Screen.getInstance();
        this.dvdPlayer = DVDPlayer.getInstance();
    }

    //根据分析 希望把代码分成4步骤

    //准备工作 将设备都打开
    public void ready(){
        popcorn.on();
        popcorn.pop();
        screen.down();
        projector.on();
        stereo.on();
        dvdPlayer.on();
        lighting.dim();
    }

    //播放动作
    public void play(){
        dvdPlayer.play();
    }

    //暂停
    public void pause(){
        dvdPlayer.pause();
    }

    //结束
    public void end(){
        popcorn.off();
        screen.up();
        projector.off();
        stereo.off();
        dvdPlayer.off();
        lighting.bright();

    }

}
